import 'package:flutter_shop/http/http.dart';
import 'package:flutter_shop/pages/base/common_result.dart';
import 'package:flutter_shop/pages/category/category_tab_page/entity/category_data.dart';
import 'package:flutter_shop/pages/category/category_tab_page/entity/category_goods_data.dart';

///分类api
class CategoryTabModel {
  ///获取分类数据
  Future<List<CategoryData>> getCategoryData() async {
    CommonResult<List<CategoryData>> result = await Http().post("getCategory");
    return result.data;
  }

  ///获取分类下的商品数据
  Future<List<CategoryGoodsData>> getCategoryGoodsData(String categoryId, String categorySubId, int page) async {
    CommonResult<List<CategoryGoodsData>> result = await Http().post("getMallGoods", data: {
      "categoryId": categoryId,
      "categorySubId": categorySubId,
      "page": page,
    });
    return result.data;
  }
}
